package com.wsq.mvvm.viewmodel

import android.view.View
import androidx.databinding.Observable
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

/**
 *
 *Date:2022/5/20
 *Time:21:47
 *author:wushengqi
 *
 * ViewModel 类让数据可在发生屏幕旋转等配置更改后继续留存。
 */
class MainViewModel:ViewModel() {
    var num = 0

    private val _currentName = MutableLiveData<String>()

    val currentName: LiveData<String> = _currentName

    val checked: MutableLiveData<Boolean> = MutableLiveData<Boolean>()

    init {
        checked.value = false
        _currentName.value = "小胖纸"
    }

    fun onClick(view: View){

        _currentName.value = "小胖纸" + ++num
    }

//    fun checked(){
//
//    }


}